﻿using System;
using System.Collections.Generic;
using System.Text;
using MAMODEL;
using MADAL;

namespace MABLL
{
    /// <summary>
    /// 登陆逻辑
    /// by add 张福鑫 20191109
    /// </summary>
    public class LoginUser: Ma_UserModel, IBLL
    {
        ///// <summary>
        ///// 用户信息
        ///// </summary>
        //public Ma_UserModel User { get; set; }
        private bool m_isonline=false;
        /// <summary>
        /// 是否在线
        /// </summary>
        public bool IsOnline 
        {
            get { return m_isonline; }
            //set { m_isonline=value; }
        }

        /// <summary>
        /// 验证用户信息
        /// </summary>
        public string VerifyLogin()
        {
            m_isonline = false;
            string msg = "";
            if (string.IsNullOrEmpty(this.Phone))
            {               
                return "手机号不能为空！";
            }
            if (string.IsNullOrEmpty(this.Psw))
            {          
                return "密码不能为空！";
            }

            bool res= MADAL.UserDal.Check(this.Phone, this.Psw,ref msg);
            if (res)
            {
                m_isonline = true;
                return msg;
            }
            else
            {
                return msg;

            }
            
        }
    }
}
